<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
<jsp:include page="../../../common/head.jsp">
	<jsp:param name="_useTab" value="true"/>
	<jsp:param name="_useUpload" value="true"/>
</jsp:include>
<script language="javascript">
	function saveinfo()
	{
		xj.extArrayAllowed = new Array('.xls','.jasper');
		var objarr = new Array(
			["reportEngine.reportName","报表名称","notEmpty",""],
			["reportEngine.reportName","报表名称","max","String:50"],
			["reportEngine.belongTable","所属模块","notEmpty",""],
			["reportEngine.belongTable","所属模块","max","String:50"],
			["reportEngine.exportServiceName","导出数据源类","max","String:100"],
			["reportEngine.exportFunctionName","导出数据源方法","max","String:100"],
			["reportEngine.importServiceName","导入业务类","max","String:100"],
			["reportEngine.importFunctionName","导入业务方法","max","String:100"],
			["reportEngine.reportParam","报表参数","max","String:200"],
			["reportEngine.pageBreakColum","分页符所在列","int","4"],
			["reportEngine.columWidthRow","列宽标识数据所在列","int","4"],
			["reportEngine.reportNote","报表说明","max","String:500"]
		);
	
		if(xj.CheckAll(objarr))
		{
			if(confirm("确认保存？"))
			{
				return true;
			}
		}
		return false;
	}
	//返回
	function goback()
	{
		window.location.href="listOwnReportEngine.do";
	}
	function setFileState()
	{
		var fileType = $("#reportType").find("option:selected").val();
		if(fileType=="jxl")
			$("#uploadFileTr").css("display","none");
		else
			$("#uploadFileTr").css("display","");
	}
	$(document).ready(function(){
		xjTabs.initTab();
		setFileState();
	});
</script>

<title>修改报表模板</title>
</head>
<body>
<form action="updateOwnReportEngine.do" method="post" name="form1" onsubmit="return saveinfo()" enctype="multipart/form-data">
<input type="hidden" name="reportEngine.state" value="${reportEngine.state}"/>
<div id="body_div">
	<w:ShowTitle name="修改报表模板">
	<w:TitleButton funcName="保存" onClickFunction="" urlImg="${ctx}/images/main/save.png" funcType="submit"/>
	<w:TitleButton funcName="返回" onClickFunction="goback()" urlImg="${ctx}/images/main/back.png"/>
	</w:ShowTitle>
	<div id="body_content">
	<div class="Sliding_tab">
		<ul>
			<li></li><li><span class="tabsLink" id="setTab0" link="#">报表信息</span></li><li></li>
			<li></li><li><span class="tabsLink" id="setTab1" link="#">用户共享</span></li><li></li>
		</ul>
	</div>
  <table width="100%" id="content0" class="tabContent">
    <tr>
	   <td width="120">模板编号</td>
	   <td class="left_align" width="180"><input type="text" name="reportEngine.reportId" id="reportId" readonly="readonly" value="${reportEngine.reportId}"/></td>
	   <td width="120">模板名称</td>
	   <td class="left_align"><input type="text" name="reportEngine.reportName" value="${reportEngine.reportName}"/></td>
    </tr>
    <tr>
	   <td>所属模块</td>
	   <td class="left_align"><input type="text" name="reportEngine.belongTable" value="${reportEngine.belongTable}"/></td>
	   <td>报表类型</td>
	   <td class="left_align">
	   		<w:select name="reportEngine.reportType" value="${reportEngine.reportType}" onchange="setFileState()" styleId="reportType">
	   			<w:option optionLabel="excel报表" optionValue="jxl"></w:option>
	   			<w:option optionLabel="excel模板型报表" optionValue="jxls"></w:option>
	   			<w:option optionLabel="jasperReport报表" optionValue="jasperReport"></w:option>
	   		</w:select>
	   </td>
    </tr>
    <tr>
	   <td>导出数据源类</td>
	   <td class="left_align"><input type="text" name="reportEngine.exportServiceName" value="${reportEngine.exportServiceName}"/></td>
	   <td>导出数据源方法</td>
	   <td class="left_align"><input type="text" name="reportEngine.exportFunctionName" value="${reportEngine.exportFunctionName}"/></td>
    </tr>
    <tr>
	   <td>导入业务类</td>
	   <td class="left_align"><input type="text" name="reportEngine.importServiceName" value="${reportEngine.importServiceName}"/></td>
	   <td>导入业务方法</td>
	   <td class="left_align"><input type="text" name="reportEngine.importFunctionName" value="${reportEngine.importFunctionName}"/></td>
    </tr>
    <tr>
		<td>报表参数</td>
        <td class="left_align" colspan="3"><input type="text" name="reportEngine.reportParam" value="${reportEngine.reportParam}" style="width:450px;"/></td>
	</tr>
    <tr>
	   <td>模板是否进行分页(jxls)</td>
	   <td class="left_align">
	   		<input type="radio" name="reportEngine.isPageBreak" value="是" class="radio"/>是
	   		<input type="radio" name="reportEngine.isPageBreak" value="否" checked="checked" class="radio"/>否
	   </td>
	   <td>分页符所在列(jxls)</td>
	   <td class="left_align"><input type="text" name="reportEngine.pageBreakColum"/></td>
    </tr>
    <tr>
	   <td>是否重新设置列宽(jxls)</td>
	   <td class="left_align">
	   		<input type="radio" name="reportEngine.isSetColumWidth" value="是" class="radio"/>是
	   		<input type="radio" name="reportEngine.isSetColumWidth" value="否" checked="checked" class="radio"/>否
	   </td>
	   <td>列宽数据所在列(jxls)</td>
	   <td class="left_align"><input type="text" name="reportEngine.columWidthRow"/></td>
    </tr>
	<tr>
		<td>说明</td>
        <td class="left_align" colspan="3"><textarea name="reportEngine.reportNote" rows="5" cols="80">${reportEngine.reportNote}</textarea></td>
	</tr>
	<tr>
	   <td>报表级别</td>
	   <td class="left_align">
	   		<input type="hidden" name="reportEngine.shareType" value="${reportEngine.shareType}"/>用户
	   </td>
	   <td></td>
	   <td class="left_align"></td>
    </tr>
	<tr id="uploadFileTr">
		<td>模板位置</td>
        <td class="left_align">
        	<input type="text" name="templatePath" value="${reportEngine.reportPath}"/>
        </td>
		<td>附件</td>
        <td class="left_align">
        	<w:uploadFile isList="false" isAdd="true" fileCount="1" folder="report"></w:uploadFile>
        	<c:if test="${reportEngine.reportPath ne null and reportEngine.reportPath ne ''}">
        		<c:if test="${reportEngine.reportType eq 'jxls'}">
		        	<a href="download.do?filename=${reportEngine.reportName}.xls&inputPath=${reportEngine.reportPath}" target="_blank">[下载]</a>
        		</c:if>
        		<c:if test="${reportEngine.reportType eq 'jasperReport'}">
		        	<a href="download.do?filename=${reportEngine.reportName}.jasper&inputPath=${reportEngine.reportPath}" target="_blank">[下载]</a>
        		</c:if>
        	</c:if>
        </td>
	</tr>
</table>
<table width="100%" id="content1" class="tabContent">
    <tr>
		<td class="td_title" width="40"><span onClick="xjCommon.checkAll('reportOwnerId_u');">全选</span></td>
		<td class="td_title" width="80">允许修改</td>
		<td width="120" class="td_title">用户ID</td>
		<td class="td_title">用户姓名</td>
		<td width="120" class="td_title">分组标识</td>
    </tr>
    <c:forEach items="${userList}" var="obj">
    <tr>
		<td><w:checkbox name="reportOwnerId_u" styleClass="checkbox" value="${obj.userId}" serverValue="${userIds}"></w:checkbox></td>
		<td>
			<c:set value="false" var="test"></c:set>
			<c:forEach var="m" items="${userEditState}">
				<c:if test="${m.userId eq obj.userId and m.editAble eq '是'}"><c:set value="true" var="test"></c:set></c:if>
			</c:forEach>
			<c:if test="${test eq 'true'}">
			<input class="radio" type="radio" name="editAble${obj.userId}" value="${obj.userId}" checked="checked"/>是<input class="radio" type="radio" name="editAble${obj.userId}" value=""/>否
			</c:if>
			<c:if test="${test eq 'false'}">
			<input class="radio" type="radio" name="editAble${obj.userId}" value="${obj.userId}"/>是<input class="radio" type="radio" name="editAble${obj.userId}" value="" checked="checked"/>否
			</c:if>
		</td>
		<td>${obj.userId}</td>
		<td>${obj.userName}</td>
		<td>${obj.groupSign}</td>
    </tr>
    </c:forEach>
</table>

</div>
</div>
</form>
</body>
</html>
